#include "log.h"

#include <stdio.h>
#include <time.h>

static const char * g_debug_level[] = {"INFO", "WARN", "ERROR", "FATAL"};

void log_to_console(char * file, int line, int level, char * msg) {
	static char buf[50];

	time_t t = time(NULL);
	struct tm *tm = localtime(&t);
	strftime(buf, sizeof(buf), "%H:%M:%S", tm);
	fprintf(stderr, "%s (%s:%d) %s - %s\n", buf, file, line, g_debug_level[level], msg);
}


